package org.xiaojl.modules.sys.entity;

import org.xiaojl.common.base.BaseEntity;
import org.xiaojl.utils.ToolUtil;

import com.baomidou.mybatisplus.annotations.TableField;
import com.baomidou.mybatisplus.annotations.TableName;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.mapper.Wrapper;

/**
 * <p>
 * 资源
 * </p>
 *
 * @author xiaojl
 * @since 2017-08-18
 */
@TableName("sys_resource")
public class SysResource extends BaseEntity<SysResource> {

    private static final long serialVersionUID = 1L;

    /**
     * 排序
     */
	private Integer seq;
    /**
     * 资源名称
     */
	private String name;
    /**
     * 资源路径
     */
	private String url;
    /**
     * 是叶子吗：
     */
	private Integer isLeaf;
    /**
     * 状态
     */
	private Integer status;
    /**
     * 目标名称
     */
	private String targetName;
    /**
     * 资源图标
     */
	private String icon;
    /**
     * 父级资源id
     */
	private Long pid;
	
	/**
	 * 菜单层级（1、2、3、4）
	 */
	private Integer level;
	
	/**
	 * 资源类别:0-菜单，1-按钮
	 */
	private Integer type;
	

	@Override
	public Wrapper<SysResource> bindingQueryWrapper() {
		Wrapper<SysResource> wrapper = new EntityWrapper<SysResource>();
		if(ToolUtil.isNotEmpty(this.name)){
			wrapper.like("name", this.name);
		}
		if(ToolUtil.isNotEmpty(this.url)){
			wrapper.like("url", this.url);
		}
		if(ToolUtil.isNotEmpty(this.isLeaf)){
			wrapper.eq("isLeaf", this.isLeaf);
		}
		if(ToolUtil.isNotEmpty(this.status)){
			wrapper.eq("status", this.status);
		}
		if(ToolUtil.isNotEmpty(this.targetName)){
			wrapper.like("targetName", this.targetName);
		}
		if(ToolUtil.isNotEmpty(this.icon)){
			wrapper.like("icon", this.icon);
		}
		if(ToolUtil.isNotEmpty(this.level)){
			wrapper.eq("level", this.level);
		}
		if(ToolUtil.isNotEmpty(this.type)){
			wrapper.eq("type", this.type);
		}
		return wrapper;
	}

	public Integer getType() {
		return type;
	}

	public void setType(Integer type) {
		this.type = type;
	}

	public Integer getLevel() {
		return level;
	}

	public void setLevel(Integer level) {
		this.level = level;
	}

	public Integer getSeq() {
		return seq;
	}

	public void setSeq(Integer seq) {
		this.seq = seq;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getUrl() {
		return url;
	}

	public void setUrl(String url) {
		this.url = url;
	}

	public Integer getIsLeaf() {
		return isLeaf;
	}

	public void setIsLeaf(Integer isLeaf) {
		this.isLeaf = isLeaf;
	}

	public Integer getStatus() {
		return status;
	}

	public void setStatus(Integer status) {
		this.status = status;
	}

	public String getTargetName() {
		return targetName;
	}

	public void setTargetName(String targetName) {
		this.targetName = targetName;
	}

	public String getIcon() {
		return icon;
	}

	public void setIcon(String icon) {
		this.icon = icon;
	}

	public Long getPid() {
		return pid;
	}

	public void setPid(Long pid) {
		this.pid = pid;
	}

}
